package com.hundsun.cprs.yyt.service.trade.enums;

import java.util.HashMap;
import java.util.Map;

public enum EnumTradeEntrustStatus {

    INIT(1, "待审核"),
    COMMITED(2, "挂售中"),
    PART_CANCELED(5, "部撤"),
    CANCELED(6, "已撤"),
    PART_DEALT(7, "部成"),
    DEALT(8, "已成"),
    DISUSED(9, "废单");

    private Integer status;
    private String desc;

    private EnumTradeEntrustStatus(Integer status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    /**
     * 全局索引池
     */
    private static Map<Integer, EnumTradeEntrustStatus> pool = new HashMap<Integer, EnumTradeEntrustStatus>();
    static {
        for (EnumTradeEntrustStatus et : EnumTradeEntrustStatus.values()) {
            pool.put(et.getStatus(), et);
        }
    }

    /**
     * 根据内容索引
     *
     * @param code
     * @return
     */
    public static EnumTradeEntrustStatus indexByValue(Integer status) {
        return pool.get(status);
    }

    public static Map<Integer, EnumTradeEntrustStatus> toMap() {
        return pool;
    }

    public Integer getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }
}
